package com.ruoyi.contract.domain;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.utils.DateUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 合同对象 contract
 *
 * @author ruoyi
 * @date 2024-10-18
 */
public class Contract extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    @Excel(name = "序号", sort = 1)
    private Integer index;

    /** id */
    private Long contractId;

    /** 合同名称 */
    @Excel(name = "合同名称", sort =5 )
    private String name;

    /** 合同编码 */
    @Excel(name = "合同编码", sort =4)
    private String code;

    /** 合同总额 */
    @Excel(name = "合同总额",sort = 10)
    private BigDecimal allMoney;

    /** 发票总额 */
    private BigDecimal allInvoiceMoney;

    /** 附件总额 */
    private BigDecimal allAppendicesMoney;

    /** 已收(付)金额 */
    @Excel(name = "实收（付）总额",sort = 11)
    private BigDecimal paidPayment;

    /** 合同所属公司id */
    private Long belongingCompanyId;

    /** 合同所属公司名称 */
    @Excel(name = "合同所属公司名称", sort =2 )
    private String belongingCompanyName;  // 新增字段

    /** 合同类型 */

    private String type; // 新增字段

    /** 合同类别id */
    private Long contractCategoryId;

    /** 合同类别名称 */
    @Excel(name = "合同类型", sort =3 )
    private String contractCategoryName;  // 新增字段

    /** 合同生效日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "合同生效日期", width = 30, dateFormat = "yyyy-MM-dd",sort = 12)
    private Date effectiveTime;

    /** 合同终止日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "合同终止日期", width = 30, dateFormat = "yyyy-MM-dd",sort = 13)
    private Date terminationTime;

    /** 合同签订日期 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "合同签订日期", width = 30, dateFormat = "yyyy-MM-dd", sort =7)
    private Date signingTime;

    /** 合同归属年份 */
    private Long belongingYear;

    /** 合同金额 */
    private BigDecimal money;

    /** 收（付）款类型 */
    @Excel(name = "收（付）款类型",sort = 9)
    private String collectionAndPaymentTypes;

    /** 收（付）款状态 */
    private String collectionAndPaymentState; // 新增字段

    /** 开票状态 */
    private String state;

    /** 合同负责人 */
    @Excel(name = "合同负责人",sort = 14)
    private String director;

    /** 原件归档位置id */
    private Long archiveLocation;  // 修改为 Long 类型

    /** 原件归档位置名称 */
    @Excel(name = "原件归档位置",sort = 15)
    private String archiveLocationName;  // 新增字段

    /** 上传者id */
    private Long addUserId;

    /** 上传者名称 */
    private String addUserName;  // 新增字段

    /** 上传时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "上传时间", width = 30, dateFormat = "yyyy-MM-dd" ,sort = 17)
    private Date addTime;

    /** 修改者id */
    private Long updateUserId;

    /** 修改者名称 */
    private String updateUserName;  // 新增字段

    /** 上传pdf地址 */
    private String pdfAddress;

    /** 签约方字符串 */
    @Excel(name = "签约方", sort =6 )
    private String partyString;

    /** 合同状态 **/
    @Excel(name = "合同状态", sort =8 )
    private String customColumn;

    /** 员工部门字符串 */
    @Excel(name = "部门", sort = 16)
    private String userDepartmentString;

    /** 备注 **/
    @Excel(name = "备注", sort =18 )
    private String remark;

    public String getCustomColumn() {
        if (effectiveTime != null && terminationTime != null) {
            if (effectiveTime.compareTo(DateUtils.getNowDate()) >0 ){//生效日期在当前日期之后
                return "未生效";
            } else if (terminationTime.compareTo(DateUtils.getNowDate()) <0 ) {//终止日期在当前日期之前
                return "已过期";
            }else{
                return "生效中";
            }
        }
        return "未知";
    }

    public void setCustomColumn(String customColumn) {
        this.customColumn = customColumn;
    }

    // Getter 和 Setter 方法
    public void setIndex(Integer index)
    {
        this.index = index;
    }

    public Integer getIndex()
    {
        return index;
    }

    public void setContractId(Long contractId)
    {
        this.contractId = contractId;
    }

    public Long getContractId()
    {
        return contractId;
    }

    public void setName(String name)
    {
        this.name = name;
    }

    public String getName()
    {
        return name;
    }

    public void setCode(String code)
    {
        this.code = code;
    }

    public String getCode()
    {
        return code;
    }

    public void setBelongingCompanyId(Long belongingCompanyId)
    {
        this.belongingCompanyId = belongingCompanyId;
    }

    public Long getBelongingCompanyId()
    {
        return belongingCompanyId;
    }

    public void setType(String type) {  // 新增 Setter
        this.type = type;
    }

    public String getType() {  // 新增 Getter
        return type;
    }

    public void setBelongingCompanyName(String belongingCompanyName)  // 新增 Getter 和 Setter
    {
        this.belongingCompanyName = belongingCompanyName;
    }

    public String getBelongingCompanyName()
    {
        return belongingCompanyName;
    }

    public void setContractCategoryId(Long contractCategoryId)
    {
        this.contractCategoryId = contractCategoryId;
    }

    public Long getContractCategoryId()
    {
        return contractCategoryId;
    }

    public void setContractCategoryName(String contractCategoryName)  // 新增 Getter 和 Setter
    {
        this.contractCategoryName = contractCategoryName;
    }

    public String getContractCategoryName()
    {
        return contractCategoryName;
    }

    public void setEffectiveTime(Date effectiveTime)
    {
        this.effectiveTime = effectiveTime;
    }

    public Date getEffectiveTime()
    {
        return effectiveTime;
    }

    public void setTerminationTime(Date terminationTime)
    {
        this.terminationTime = terminationTime;
    }

    public Date getTerminationTime()
    {
        return terminationTime;
    }

    public void setSigningTime(Date signingTime)
    {
        this.signingTime = signingTime;
    }

    public Date getSigningTime()
    {
        return signingTime;
    }

    public void setBelongingYear(Long belongingYear)
    {
        this.belongingYear = belongingYear;
    }

    public Long getBelongingYear()
    {
        return belongingYear;
    }

    public void setMoney(BigDecimal money)
    {
        this.money = money;
    }

    public BigDecimal getMoney()
    {
        return money;
    }

    public void setCollectionAndPaymentTypes(String collectionAndPaymentTypes)
    {
        this.collectionAndPaymentTypes = collectionAndPaymentTypes;
    }

    public String getCollectionAndPaymentTypes()
    {
        return collectionAndPaymentTypes;
    }

    public void setCollectionAndPaymentState(String collectionAndPaymentState)
    {
        this.collectionAndPaymentState = collectionAndPaymentState;
    }

    public String getCollectionAndPaymentState()
    {
        return collectionAndPaymentState;
    }

    public void setState(String state)
    {
        this.state = state;
    }

    public String getState()
    {
        return state;
    }

    public void setDirector(String director)
    {
        this.director = director;
    }

    public String getDirector()
    {
        return director;
    }

    public void setArchiveLocation(Long archiveLocation)
    {
        this.archiveLocation = archiveLocation;
    }

    public Long getArchiveLocation()
    {
        return archiveLocation;
    }

    public void setArchiveLocationName(String archiveLocationName)  // 新增 Getter 和 Setter
    {
        this.archiveLocationName = archiveLocationName;
    }

    public String getArchiveLocationName()
    {
        return archiveLocationName;
    }

    public void setAddUserId(Long addUserId)
    {
        this.addUserId = addUserId;
    }

    public Long getAddUserId()
    {
        return addUserId;
    }

    public void setAddUserName(String addUserName)  // 新增 Getter 和 Setter
    {
        this.addUserName = addUserName;
    }

    public String getAddUserName()
    {
        return addUserName;
    }

    public void setAddTime(Date addTime)
    {
        this.addTime = addTime;
    }

    public Date getAddTime()
    {
        return addTime;
    }

    public void setUpdateUserId(Long updateUserId)
    {
        this.updateUserId = updateUserId;
    }

    public Long getUpdateUserId()
    {
        return updateUserId;
    }

    // Getter and Setter for allMoney
    public BigDecimal getAllMoney() {
        return allMoney;
    }

    public void setAllMoney(BigDecimal allMoney) {
        this.allMoney = allMoney;
    }

    // Getter and Setter for allInvoiceMoney
    public BigDecimal getAllInvoiceMoney() {
        return allInvoiceMoney;
    }

    public void setAllInvoiceMoney(BigDecimal allInvoiceMoney) {
        this.allInvoiceMoney = allInvoiceMoney;
    }

    // Getter and Setter for allAppendicesMoney
    public BigDecimal getAllAppendicesMoney() {
        return allAppendicesMoney;
    }

    public void setAllAppendicesMoney(BigDecimal allAppendicesMoney) {
        this.allAppendicesMoney = allAppendicesMoney;
    }

    // Getter and Setter for paidPayment
    public BigDecimal getPaidPayment() {
        return paidPayment;
    }

    public void setPaidPayment(BigDecimal paidPayment) {
        this.paidPayment = paidPayment;
    }

    public void setUpdateUserName(String updateUserName)  // 新增 Getter 和 Setter
    {
        this.updateUserName = updateUserName;
    }

    public String getUpdateUserName()
    {
        return updateUserName;
    }

    public void setPdfAddress(String pdfAddress)
    {
        this.pdfAddress = pdfAddress;
    }

    public String getPdfAddress()
    {
        return pdfAddress;
    }

    public void setPartyString(String partyString)
    {
        this.partyString = partyString;
    }

    public String getPartyString()
    {
        return partyString;
    }

    public void setUserDepartmentString(String userDepartmentString)
    {
        this.userDepartmentString = userDepartmentString;
    }

    public String getUserDepartmentString()
    {
        return userDepartmentString;
    }

    public void setRemark(String remark)
    {
        this.remark = remark;
    }

    public String getRemark()
    {
        return remark;
    }
    @Override
    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                .append("index",getIndex())//新增
                .append("contractId", getContractId())
                .append("name", getName())
                .append("code", getCode())
                .append("allMoney",getAllMoney())// 新增
                .append("allInvoiceMoney", getAllInvoiceMoney())// 新增
                .append("allAppendicesMoney", getAllAppendicesMoney())// 新增
                .append("paidPayment", getPaidPayment())  // 新增
                .append("belongingCompanyId", getBelongingCompanyId())
                .append("belongingCompanyName", getBelongingCompanyName())  // 新增
                .append("contractCategoryId", getContractCategoryId())
                .append("contractCategoryName", getContractCategoryName())  // 新增
                .append("effectiveTime", getEffectiveTime())
                .append("terminationTime", getTerminationTime())
                .append("signingTime", getSigningTime())
                .append("belongingYear", getBelongingYear())
                .append("money", getMoney())
                .append("collectionAndPaymentTypes", getCollectionAndPaymentTypes())
                .append("collectionAndPaymentState", getCollectionAndPaymentState())// 新增
                .append("state", getState())
                .append("director", getDirector())
                .append("archiveLocation", getArchiveLocation())
                .append("archiveLocationName", getArchiveLocationName())  // 新增
                .append("remark", getRemark())
                .append("addUserId", getAddUserId())
                .append("addUserName", getAddUserName())  // 新增
                .append("addTime", getAddTime())
                .append("updateUserId", getUpdateUserId())
                .append("updateUserName", getUpdateUserName())  // 新增
                .append("updateTime", getUpdateTime())
                .append("pdfAddress", getPdfAddress())
                .append("type", getType()) // 新增
                .append("partyString", getPartyString()) // 新增
                .append("customColumn",getCustomColumn())//新增
                .append("userDepartmentString",getUserDepartmentString())
                .append("remark",getRemark())
                .toString();
    }
}
